<template>
  <div class="win">
    <div class="chuang">
      <div class="beijing">
        <div class="ziti">
          <div>
            <p>首页 / 课程详情</p>
          </div>

          <div style="position: relative;bottom: 10%;display: flex;">
            <div style=" font-weight: bold; font-size: 25px;">{{ useData.theDetail?.name }}</div>
            <div style="position: relative;top: 20%;">(已选{{ useData.theDetail?.choosedNum }}人)</div>
          </div>

          <div style="display: flex;margin-top: 30px; justify-content: space-between;position: relative;bottom: 25%;">

            <div style="display: flex;justify-content: flex-start;align-items: center; width: 150px;">
              <div style="position: relative; border-radius: 50%;width: 60px;height: 60px; background-color: white;"
                class="t"> </div>
              <div style="margin: auto;">
                <p>{{ useData.theDetail?.mainDesignerUserName }}</p>
                <p style="background-color: rgb(203, 203, 8) ;text-align: center;border-radius: 5px;">教师</p>
              </div>

            </div>
            <div style="position: relative;top: 40%;right: 50%;">课程成绩</div>
          </div>

        </div>

      </div>

      <div class="luyou">
        <div class="bao">
          <div class="lu"><router-link to="/front/task" style="color: black;font-size: 20px;">任务</router-link></div>
          <div class="lu"><router-link to="/front/answer" style="color: black;font-size: 20px;">问答</router-link></div>
          <div class="lu"><router-link to="/front/progress" style="color: black;font-size: 20px;">进度榜</router-link>
          </div>
          <div class="lu"><router-link to="/front/vote" style="color: black;font-size: 20px;">投票榜</router-link></div>
        </div>
        <RouterView></RouterView>


      </div>

      <!-- <div class="bai">

      </div> -->

    </div>

  </div>
  <div class="footer">
    <div>
      <span>企业服务</span>
      <span @click="toours">关于我们</span>
      <span>联系我们</span>
      <span>帮助中心</span>
      <span>意见反馈</span>
    </div>
    <p>&copy;2024 wang.club 版权所有 粤ICP备20054546号-1</p>
  </div>

</template>


<script setup>
  import useDataStore from "@/stores/Data";
  import { ref, inject, onMounted } from 'vue';
  import { useRoute, useRouter } from 'vue-router';
  import { ElTabs, ElTabPane, ElCollapse, ElCollapseItem } from 'element-plus'
  import { RouterView, RouterLink } from 'vue-router'



  const route = useRoute()
  const aboutitem = inject('aboutitem');
  const router = useRouter();
  const useData = useDataStore()


  function toours() {
    aboutitem.value = true;
    router.push('/aboutview');
  }
  onMounted(() => {

    // 在组件挂载后调用 getDetailData 函数，并将 corId 转换为数字  
    useData.getDetailData(Number(route.query.corId));
    // corrNo.value = Number(route.query.corrNo);  

    // // 调用 getDetailData 函数，并传入转换后的 corrNo 数字  
    // useData.getDetailData(corrNo.value);  
    //   const corrNo = route.query.corrNo;  
    //   if (corrNo == null) {  
    //     console.error('Correlation number is missing or null.');  
    //     return;  
    //   }  
    //   if (typeof corrNo !== 'string') {  
    //     console.error('Correlation number is not a string.');  
    //     return;  
    //   }  
    //   const numberString = corrNo.replace(/[^\d]/g, ''); 
    // const numCorrNo = Number(numberString);  
    // if (isNaN(numCorrNo)) {  
    //   // 转换失败，corrNo 不是一个有效的数字字符串  
    //   console.error('Invalid correlation number:', numCorrNo);  
    //   // 处理错误情况，比如重定向、显示错误信息等  
    // } else {  
    //   // 转换成功，numCorrNo 是一个数字  
    //   useData.getDetailData(numCorrNo);  
    // }

  }); 
</script>

<style scoped>
  .win {

    position: relative;
    width: 100vw;
    height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
  }

  .chaung {
    display: flex;
    flex-direction: column;
  }

  .beijing {
    background-image: url(https://www.codelover.club/static/img/courseBg.43bcf71c.png);
    left: 0;
    position: relative;
    /* border: 2px red solid; */
    width: 100vw;
    height: 200px;
    background-color: rgb(37, 37, 144);

  }


  .luyou {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.10), 0 6px 6px rgba(0, 0, 0, 0.10);
    position: absolute;
    left: 0;
    top: 23%;
    background-color: rgb(255, 255, 255);
    width: 100vw;
    height: 85px;
    z-index: 10;

  }

  .bao {

    text-align: center;
    position: relative;
    top: 20%;
    left: 15%;
    /* background-color: pink; */
    width: 500px;
    height: 50px;
    display: flex;
    justify-content: space-between;
  }

  .lu {
    margin: auto;
  }

  .bai {
    position: absolute;
    right: 0;
    top: 32%;
    background-color: rgb(16, 50, 99);
    height: 100vh;
    width: 100vw;
  }


  .ziti {
    color: white;
    display: flex;
    flex-direction: column;

    width: 500px;
    height: 180px;
    position: relative;
    top: 2%;
    left: 15%;
  }


  .t {
    background-image: url(https://codelover.club/icons/course/icon1.svg);
  }

  .router-link-active {
    text-decoration: underline;
    font-weight: 600;
  }


  .footer {
    position: relative;
    bottom: 0;
    width: 100%;
    height: 150px;
    /* 改为小写 px */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    /* 改为小写 px */
    color: #999;
    background-color: #847f7f4b;
  }

  .footer p {
    width: 100%;
    text-align: center;
    /* 居中显示文本 */
    margin-top: 2%;
    color: #8d8787;
  }

  .footer div {
    width: 100%;
  }

  .footer span {
    color: #828384;
    font-size: larger;
    margin-left: 5%;
    margin-top: 5%;
    cursor: pointer;
  }
</style>